<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">    
        
        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <style>
            body {
                font-family: 'Nunito';
            }
        </style>
    </head>
    <body class="antialiased">
        <div class="row">
          <div class="col-xs-12 col-md-8">
                <h1>密码记录</h1>
                <table class="table table-striped">
                    <tr>
                    <th>密码</th>
                    <th>是否当前使用中</th>
                    <th>生成日期</th>
                    <th>操作</th>
                    </tr>
                    @foreach ($lists as $list)
                    <tr>
                        <td>{{$list->passwords}}</td>
                        <td>
                            @if($list->status ==1)
                           <button type="button" class="btn btn-danger">使用中</button>
                           @else 
                           <button type="button" class="btn btn-default">未使用</button>
                           @endif
                        </td>
                        <td>{{$list->created_at}}</td>
                        <td>
                            
                             @if($list->status ==1)
                            <a class="btn btn-success" href="{{url('/unsetUse/'.$list->id)}}" role="button">取消使用</a>
                            @else 
                            <a class="btn btn-success" href="{{url('/setUse/'.$list->id)}}" role="button">置为当前使用中</a>
                            <a class="btn btn-success" href="{{url('/delete/'.$list->id)}}" role="button">删除</a>
                            @endif
                            

                        </td>
                    </tr>
                    @endforeach
                </table>
          </div>
          <div class="col-xs-12 col-md-4">
            <h1>生成新密码</h1>
            <div>
                <a class="btn btn-default" href="{{url('/getPwd')}}" role="button">随机生成</a> 
                <a class="btn btn-default" href="JavaScript:$('#pwdForm').toggle();" role="button">自定义</a> 
                <p class="bg-primary" style="margin-top: 20px">生成规则：数字，字母，特殊字符组合，不小于12个字符，必须包含大写字母</p>
            </div>
            <form action="{{url('/ruleGetPwd')}}" method="post" id='pwdForm' style="display: none">
              <div class="form-group">
                <label for="EnWord">英文字母数量(a-zA-Z)</label>
                <input type="text" class="form-control" name='EnWord' id="EnWord" placeholder="英文字母数量">
              </div>
              <div class="form-group">
                <label for="BigEnWord">大写字母数量(A-Z)</label>
                <input type="text" class="form-control" name='BigEnWord' id="BigEnWord" placeholder="大写字母数量">
              </div>
              <div class="form-group">
                <label for="Num">数字数量(0-9)</label>
                <input type="text" class="form-control" name='Num' id="Num" placeholder="数字数量">
              </div>
              <div class="form-group">
                <label for="Specail">特殊字符数量</label>
                <input type="text" class="form-control" name='Specail' id="Specail" placeholder="特殊字符数量">
              </div>
              @csrf
              
              <button type="submit" class="btn btn-default">规则生成</button>
            </form>        
            </div>
        </div>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    </body>
</html>
